﻿/*
大数和 
Time Limit:1000MS  Memory Limit:32768K


Description:
有一些可能达100位的大正整数，求所有这些数的和。 

Sample Input:
9999999999123456789
900000010
0
Sample Output:
10000000000023456799
*/
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

int toint(const char& ch)
{
	return ch - '0';
}
int main(int argc, char* argv[])
{
	vector<int> sum(100, 0);
	for (string num; cin >> num;)
	{
		if ("0" == num)
			break;
		int length = num.length();
		if (length > sum.size())
			sum.resize(3 * length / 2);

		vector<int> addend(length);
		transform(num.rbegin(), num.rend(), addend.begin(), toint);

		//copy(addend.begin(), addend.end(), ostream_iterator<int>(cout, " "));
		int carry = 0, size = addend.size();
		for (int i = 0; i < size; i++)
		{
			int temp = sum[i] + addend[i] + carry;
			sum[i] = temp % 10;
			carry = temp / 10;
		}
		while (carry)
		{
			int temp = sum[size] % 10 + carry;
			sum[size++] = temp % 10;
			carry = temp / 10;
		}
	}
	int i = sum.size() - 1;
	for (; 0 == sum[i] && i >= 0; i--)
		;
	for (; i >= 0; i--)
		cout << sum[i];
	cout << endl;
	return 0;
}